home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
asm_msc1.arc
/
AUTODATE.DOC
< prev
next >
Wrap
Text File
|
1988-11-20
|
3KB
|
66 lines
AUTODATE
========
The AUTODATE program maintains a date file which is used to supply
the date and time for the system after a System Restart is performed.
There are four files involved:
AUTODATE.ASM - Assembly source
AUDODATE.BAS - BASIC version
AUTODATE.DAT - The Date file, required
AUTODATE.COM - Assembled and linked, executable module
The date file is named AUTODATE.DAT and consists of two records, one
with the current date in the form MM-DD-YYYY, and the second with the
current time in the form HH:MM:SS. The program does not create the
date file, so use EDLIN (or similar program) to allocate it.
When the program is invoked, it obtains the current date and time
from DOS. If the date is 01-01-1980, a power-on is assumed and a new
date and time is read from the DAT file. Otherwise, the current DOS
values are used. To run the program after System Restart, place the
command AUTODATE into the AUTOEXEC.BAT file.
The user is prompted for the date and time, just as if the DATE and
TIME commands had been used. Pressing the ENTER key tells the program
to use the displayed value. An incorrect value (bad syntax, etc)
generates an error message and a new prompt. Control-break can be used
to exit the program. Supply the date/time values with leading digits.
Enter new date: 11-02-1983
Enter new time: 12:15:30
A useful feature of this program is its forgiving nature (simple minded).
Either the DATE and/or TIME may be supplied with only one digit. For
example,
Enter new date: 11-02
Enter new time: 12:20
and thereby cut down on key strokes a bit. Leading zeros must be entered.
=============================
The program began as a BASIC program, but the Assembler version is
more econimical in terms of disk space, etc.
01 ' AUTODATE.BAS
10 CLS : CLOSE
20 ON ERROR GOTO 90
30 DD$=DATE$ : TT$=TIME$ : IF MID$(DD$,1,10)<>"01-01-1980" THEN GOTO 90
40 OPEN "AUTODATE.DAT" FOR INPUT AS #1
50 IF EOF(1) GOTO 80 : ON ERROR GOTO 80
60 LINE INPUT #1,DD$ : DATE$=MID$(DD$,6,10)
70 LINE INPUT #1,TT$ : TIME$=MID$(TT$,6,8)
80 CLOSE #1
90 PRINT "The date is ",DATE$
100 INPUT "Enter date: ",D$
110 IF LEN(D$)>0 THEN DATE$=D$
120 PRINT "The time is ",TIME$
130 INPUT "Enter time: ",T$
140 IF LEN(T$)>0 THEN TIME$=T$
150 OPEN "AUTODATE.DAT" FOR OUTPUT AS #1
160 DD$=DATE$ : TT$=TIME$
170 PRINT #1,"DATE=";DD$
180 PRINT #1,"TIME=";TT$
190 CLOSE #1
200 END
Written by Vern Buerg for public domain use, October, 1983.